<%-- <%@ page contentType="text/html;charset=UTF-8"  language="java" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<html>
  <head>
     <title>首页</title>
   </head>
   <body>
     <a href="login.jsp">login</a>
     <div>
        <shiro:guest>
          <p>欢迎游客访问,<a href="login.jsp">登陆</a></p>
        </shiro:guest>
     </div>
   </body>
</html> --%>
<!-- <html>
   <head>
     <title>首页</title>
   </head>
   <body>
     <a href="${pageContext.request.contextPath}/login">登陆</a><br/>
     <a href="${pageContext.request.contextPath}/authenticated">已身份认证</a>
     <a href="${pageContext.request.contextPath}/role">角色授权</a>
     <a href="${pageContext.request.contextPath}/permission">权限授权</a>
   </body>
</html>
 -->
<!-- session的会话管理index页面 -->
<%@ page import="org.apache.shiro.SecurityUtils"%>
<%@ page import="org.apache.shiro.session.mgt.OnlineSession" %>
<%@ page import="com.example.demo.session.dao.MySessionDAO" %>
<%@ page import="java.io.Serializable"%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<html>
<body>
   <shiro:guest>
       <p>欢迎游客访问,<a href="${pageContext.request.contextPath}/login.jsp">点击登陆</a></p>
   </shiro:guest>
   <shiro:user>
       <p>欢迎[<shiro:principal/>]登陆,<a href="${pageContext.request.contextPath}/logout">点击退出</a></p>
   </shiro:user>
   
   <shiro:user>
       <% 
           SecurityUtils.getSubject().getSession().setAttribute("key","123");
           out.print(SecurityUtils.getSubject().getSession().getAttribute("key"));
       %>
       <br/>
       <% 
           MySessionDAO sessionDAO= new MySessionDAO();
           Serializable sessionId=SecurityUtils.getSubject().getSession().getId();
           OnlineSession onlineSession= (OnlineSession)sessionDAO.readSession(sessionId);
           out.print(onlineSession.getStatus().getInfo());
       %>
   </shiro:user>
</body>
</html>
